<template>
  <div>
    <img :src="$pre + obj.img" alt="" />
    <div>名称：{{ obj.goodsname }}</div>
    <div v-html="obj.description"></div>
    <div v-if="obj.price">价格：{{ obj.price | filterPrice }}</div>
    <v-picker v-if="isshow" :obj="obj" @hide="isshow = false"></v-picker>
    <van-goods-action>
      <van-goods-action-icon icon="chat-o" text="客服" dot />
      <van-goods-action-icon icon="cart-o" text="购物车" dot  @click="$router.push('/index/shop')"/>
      <van-goods-action-icon icon="shop-o" text="店铺" dot />
      <van-goods-action-button type="warning" text="加入购物车" @click="isshow=true"/>
      <van-goods-action-button type="danger" text="立即购买" @click="isshow=true"/>
    </van-goods-action>
  </div>
</template>

<script>
import axios from "axios";
import vPicker from "./components/picker.vue";
import { getDetail } from "../../http/http";

export default {
  components: {
    vPicker,
  },
  data() {
    return {
      obj: {},
      isshow: false,
    };
  },
  activated() {
    getDetail(this.$route.params.id).then((res) => {
      // console.log(res);
      this.obj = res.data.list[0];
      this.obj.specsattr = this.obj.specsattr.split(",");
    });
  },
};
</script>

<style scoped>
img{
  width: 100vw;
}
</style>